<?php
/**
 * @author    :liuqiangde<liuqiangde@dalingpao.com>
 * @copyright : 2017-08-21
 */
class DAL_Admin_Home extends Q_DAL_Module
{
    /**
     * 模型名称
     *
     * @var string
     */
    protected $_modelName = 'Model_Admin_Home';

    /**
     * 保存用户
     *
     * @param array $param
     *
     * @return bool|int
     */
    public function callSave(array $param = [])
    {
        $paramObj = Q_Helper_Array::instance($param);

        $_rules = [
            'name'   => $paramObj::VAL_TYPE_FUNC_STRING,
            'gender' => $paramObj::VAL_TYPE_FUNC_STRING,
            'age'    => $paramObj::VAL_TYPE_FUNC_INT,
            'nation' => $paramObj::VAL_TYPE_FUNC_STRING,
            'number' => $paramObj::VAL_TYPE_FUNC_STRING,
        ];

        if (empty($data['id'])) {
            $_rules['id'] = $paramObj::VAL_TYPE_FUNC_UINT;
        }

        $option = $paramObj->setRules($_rules)->getSafeArr();

        return $this->getModel()->save($option, true);
    }
}

?>